export function AppConfig(app){
	app.config.globalProperties.formatImage = function (url = '') {
		let base = 'https://img.qumoyugo.com'
		return base + url
	}
	app.config.globalProperties.fillImageUrl = function (imgUrl = '') {
		if(!imgUrl){return "";}
		let base = 'https://img.qumoyugo.com'
		let url = /^http|https/.test(imgUrl);
		if(url){
			return imgUrl;
		} else{
			return base + imgUrl;
		}
	}
}
export function dataURItoBlob(dataURI){
	// 分离出 base64 编码部分
	var base64Index = dataURI.indexOf(';base64,') + ';base64,'.length;
	var base64 = dataURI.substring(base64Index);
	// 将 base64 字符串解码为二进制数据
	var byteString = atob(base64);
	// 创建个空的 Uint8Array
	var arrayBuffer = new ArrayBuffer(byteString.length);
	var uint8Array = new Uint8Array(arrayBuffer);
	// 将解码后的二进制数据复制到 Uint8Array
	for (var i = 0; i < byteString.length; i++) {
		uint8Array[i] = byteString.charCodeAt(i);
	}
	// 创建并返回 Blob 对象
	return new Blob([arrayBuffer], { type: 'image/jpeg' });
}
